#include <stdio.h>
#include <memory.h>
#include <string.h>

int count, t;
bool visit[ 10001 ];

struct node
{
    int v;
    node *next;
}*edge[ 10001 ], *s[ 10001 ], *fedge[ 10001 ], *fs[ 10001 ];;

void dfs( int n, node *e[] )
{
    node *p = e[ n ];
    p = p->next;
    while ( p )
    {
        if ( !visit[ p->v ] )
        {
            count++;
            visit[ p->v ] = true;
            dfs( p->v, e );
        }
        p = p->next;
    }
}

inline int get( char *s )
{
    int t2 = 0, len = strlen( s );
    for ( ; t < len; t++ )
        if ( s[ t ] >= '0' && s[ t ] <= '9' )
            t2 = t2 * 10 + s[ t ] - '0';
        else
            return t2;
    return t2;
}
    
int main( )
{
    int n, m, i, a, b;
    char data[ 14 ];
    for ( i = 1; i <= 10000; i++ )
    {
        edge[ i ] = new node;
        fedge[ i ] = new node;
    }
    while ( gets( data ) )
    {
        t = 0;
        n = get( data );
        t++;
        m = get( data );
        if ( n == 0 && m == 0 ) break;
        for ( i = 1; i <= n; i++ )
        {
            edge[ i ]->next = NULL;
            fedge[ i ]->next = NULL;
            s[ i ] = edge[ i ];
            fs[ i ] = fedge[ i ];
        }
        for ( i = 1; i <= m; i++ )
        {
            t = 0;
            gets( data );
            a = get( data );
            t++;
            b = get( data );
            node *p = new node;
            s[ a ]->next = p;
            p->next = NULL;
            p->v = b;
            s[ a ] = p;
            node *fp = new node;
            fs[ b ]->next = fp;
            fp->next = NULL;
            fp->v = a;
            fs[ b ] = fp;
        }
        memset( visit, 0, sizeof( visit ) );
        count = 1;
        visit[ 1 ] = true;
        dfs( 1, edge );
        if ( count == n )
        {
            count = 1;
            memset( visit, 0, sizeof( visit ) );
            visit[ 1 ] = true;
            dfs( 1, fedge );
            if ( count == n )
                puts("Yes");
            else
                puts("No");
        }
        else
            puts("No");
    }
    return 0;
}
